<template>
	<view class="content">
		<view class="top">
			<view class="topcont">
				<view class="detail_fl">
					<image class="userAvatar" :src="datas.avatar" mode=""></image>
					<view class="brouser_info">
						<view class="brouser_name ellipsis">{{datas.nickname}}</view>
						<view class="broNum">队员：{{datas.juniorNum}}人</view>
					</view>
				</view>
				<view class="detail_fr">
					<view class="bropay"><text class="iconfont sign">&#xe604;</text>{{datas.brokeragePrice}}</view>
				</view>
			</view>
		</view>
		
		<view class="detailgroup">
			<mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback" >
				<view class="detail_list" v-for="(item,index) in list" :key="index">
					<view class="detail_fl">
						<!-- <image class="userAvatar" :src="item.avatar" mode=""></image> -->
						<view class="brouser_info">
							<view class="brouser_name">
								<view class="userName ellipsis">{{item.type == 1 ? '拍卖商品' : '购买商品'}}</view>
								<view class="receivedType">已收</view>
							</view>
							<view class="broNum">{{item.createTime}}</view>
						</view>
					</view>
					<view class="detail_fr">
						<view class="bropay">+{{item.price}}</view>
					</view>
				</view>
			</mescroll-body>
		</view>
		
		
	</view>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				downOption: {
					auto: true //是否在初始化后,自动执行downCallback; 默认true
				},
				upOption: {
					auto: true, // 不自动加载
					// page: {
					// 	num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
					// 	size: 10 // 每页数据的数量
					// },
					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
					empty: {
						tip: '~ 空空如也 ~', // 提示
						btnText: '刷新',
						// 列表第一页无任何数据时,显示的空布局
						// use : 是否启用
						// icon : 空布局的图标路径 (支持网络路径)
						// tip : 提示文本
						// btnText : 按钮文本
						// fixed : 是否使用定位,默认false; 配置fixed为true,以下的top和zIndex才生效 (transform会使fixed失效,所以最终还是会降级为absolute)
						// top : fixed定位的top值 (完整的单位值,如"100rpx", "10%";)
						// zIndex : fixed定位z-index值
					},
					textNoMore: "--我也是有底线的--" //没有更多数据的提示文本
				},
				list:[],
				datas:{},
				uId:''
			}
		},
		onLoad(options) {
			console.log(options)
			this.uId = options.uId
		},
		methods: {
			downCallback(){
				this.mescroll.resetUpScroll(); //调用加载
			},
			upCallback(page) {
				console.log(page)
				let that = this;
				that.api.otherUserBrokerageDetail({
					page:page.num,
					limit:page.size,
					otherUid:that.uId
				}).then(res => {
					console.log(res)
					that.datas = res.data.juniorUserData;
					let curPageData =res.data.distributorDetail.records;
					// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
					let curPageLen = curPageData.length;
					// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
					let totalPage = res.data.distributorDetail.pages;
					//设置列表数据
					setTimeout(() => { // 模拟效果
						if (page.num == 1) this.list = []; //如果是第一页需手动置空列表
						this.list = this.list.concat(curPageData); //追加新数据
						console.log(this.list,"-----");
						// 请求成功,隐藏加载状态
						//方法一(推荐): 后台接口有返回列表的总页数 totalPage
						this.mescroll.endByPage(curPageLen, totalPage);
					}, 500)
					
				})
				
			},
		}
	}
</script>

<style lang="less">
	page {
		width: 100%;
		box-sizing: border-box;
		letter-spacing: 3rpx;
		font-family: 'PingFang SC';
		background: #FFFFFF;
		font-size: 30rpx;
		color: #140005;
	}
	.content {
		width: 100%;
		box-sizing: border-box;
	}
	.top {
		width: 100%;
		box-sizing: border-box;
		background: #F5F5F5;
		padding: 20rpx 0;
		.topcont {
			width: 100%;
			box-sizing: border-box;
			background: #FFFFFF;
			padding: 20rpx 40rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.detail_fl {
				width: 75%;
				box-sizing: border-box;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				font-size: 30rpx;
				color: #212121;
				.userAvatar {
					width: 64rpx;
					height: 64rpx;
					border-radius: 50%;
				}
				.brouser_info {
					// width: calc(100% - 64rpx);
					width: 100%;
					box-sizing: border-box;
					padding-left: 20rpx;
					display: flex;
					flex-flow: column;
					justify-content: space-between;
					.broNum {
						font-size: 24rpx;
						color: #666666;
					}
					
				}
			}
			.detail_fr {
				width: 25%;
				box-sizing: border-box;
				display: flex;
				justify-content: flex-end;
				align-items: center;
				font-size: 30rpx;
				color: #E42221;
				line-height: 70rpx;
				.broIcon {
					font-size: 28rpx;
					color: #999999;
				}
				.sign {
					color: #FFDA71;
				}
			}
			
		}
		
	}
	.detailgroup {
		width: 100%;
		box-sizing: border-box;
		background: #FFFFFF;
		.detail_list {
			width: 100%;
			box-sizing: border-box;
			padding: 35rpx 39rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 2rpx solid #F5F5F5;
			.detail_fl {
				width: 70%;
				box-sizing: border-box;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				font-size: 30rpx;
				color: #212121;
				.userAvatar {
					width: 64rpx;
					height: 64rpx;
					border-radius: 50%;
				}
				.brouser_info {
					width: calc(100% - 64rpx);
					box-sizing: border-box;
					padding-left: 20rpx;
					display: flex;
					flex-flow: column;
					justify-content: space-between;
					.brouser_name {
						width: 100%;
						box-sizing: border-box;
						display: flex;
						justify-content: flex-start;
						align-items: center;
						.userName {
							max-width: 75%;
						}
						.receivedType {
							width: 68rpx;
							height: 28rpx;
							font-size: 22rpx;
							border: 1rpx solid #C7973B;
							text-align: center;
							line-height: 28rpx;
							color: #C7973B;
							margin-left: 10rpx;
						}
						
						
						
					}
					
					
					.broNum {
						font-size: 24rpx;
						color: #666666;
					}
					
				}
			}
			.detail_fr {
				width: 30%;
				box-sizing: border-box;
				text-align: right;
				font-size: 30rpx;
				color: #E42221;
				line-height: 70rpx;
			}
			
		}
		
				
		
	}

</style>
